import type { ResponseData } from ".";
import { ElMessage } from "element-plus";

const code = {
  // 登录失败
  LOGIN_FAIL: 1005
};

export function handleCode(res: ResponseData<string>) {
  switch (res.code) {
    case code.LOGIN_FAIL:
      // 登录失败
      ElMessage.error("登录失败");
      break;
    default:
      ElMessage({
        message: res.message,
        type: "error",
        duration: 1000
      });
      break;
  }
}
